/*
	File:		BackstabBot.cpp
	Author:		Ben Feldmann
	Purpose:	Class to manage game BackstabBot enemies
*/

#include "BackstabBot.h"
#include "IEntity.h"
#include "SGD Wrappers/CSGD_TextureManager.h"
#include "SGD Wrappers\CSGD_Direct3D.h"


BackstabBot::BackstabBot() 
{
	SetHealth(300.0f);
	SetDifficulty(12);
	SetX(400);
	SetY(400);
	SetWidth(64);
	SetHeight(64);
	SetTextureID(CSGD_TextureManager::GetInstance()->LoadTexture(_T("Graphics/Dummy Images/backstabEnemy.png")));
}

BackstabBot::~BackstabBot() 
{	
	if(GetTextureID() != -1 )
	{
		CSGD_TextureManager::GetInstance()->UnloadTexture(GetTextureID());
		SetTextureID(-1);
	}
}

void BackstabBot::Update(float elapsed) 
{
	int x = rand() % 4 + 1;

	switch(x)
	{
	case 1:
		SetY(GetY()-50*elapsed);
		break;
	case 2:
		SetX(GetX()+50*elapsed);
		break;
	case 3:
		SetY(GetY()+50*elapsed);
		break;
	case 4:
		SetX(GetX()-50*elapsed);
		break;
	}
	enemy.Update(elapsed);
}

void BackstabBot::Render() 
{
	/*if(GetTextureID() != -1)
	{
		CSGD_TextureManager::GetInstance()->Draw(GetTextureID(), int(GetX()), int(GetY()));
	}*/

	CSGD_Direct3D::GetInstance()->DrawRect(GetRect(),255,255,255);

	enemy.Render(int(GetX()), int(GetY()), 1.0f, D3DCOLOR_XRGB(255, 255, 255), false);
}

//bool BackstabBot::CheckCollision(IEntity* base) 
//{
//	throw "Not yet implemented";
//}

void BackstabBot::Attack() 
{
	throw "Not yet implemented";
}
